#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

class Solution1 {
    public:
        bool isPalindrome(int x) {
            int reverse = 0;
            int tmp = x;
            
            while (x > 0) {
                //cout << x << " " << reverse << endl;
                if (x/10 == reverse && reverse != 0) return true;
                reverse = reverse*10 + x%10; 
                x = x/10; 
            }
            return tmp == reverse;;                      
        }
};

class Solution {
    public:
        bool isPalindrome(int x) {
            int reverse = 0;
            
            while (x > 0) {
		reverse  = reverse*10 + x%10;
		cout << x << " " << reverse << endl;
		if (x == reverse) {return true; }
		x /= 10;
		cout << x << " " << reverse << endl;
	        if (x == reverse) {return true; }
            }
	    return false;
        }
};
int main(int argc, char **argv)
{
    Solution mySolution;
    bool result; //= mySolution.isPalindrome(21477);
    result = mySolution.isPalindrome(1234321);
    cout << result << endl;
}
